Adds the container type and cache type to XCSV.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 14 May 2004 17:54:47 +0000 (17:54 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 14 May 2004 17:54:47 +0000 (17:54 +0000)
gpsbabel/csv_util.c
gpsbabel/gpx.c
gpsbabel/style/README.style

index 3f577afec0ffb12ded144581a1f41909f24584ce..826890826b310771c9579abc995aaf658fb6e73a 100644 (file)
@@ -801,9 +801,13 @@ xcsv_waypt_pr(const waypoint *wpt)
             /* Geocache Terrain as a double */
             sprintf(buff, fmp->printfc, wpt->gc_data.terr / 10.0);
         } else
-        if (strcmp(fmp->key, "GEOCACHE_TYPE") == 0) {
-            /* Geocache Type TODO */
-            sprintf(buff, fmp->printfc, "Geocache");
+        if (strcmp(fmp->key, "GEOCACHE_CONTAINER") == 0) {
+            /* Geocache Container */
+            sprintf(buff, fmp->printfc, gs_get_container(wpt->gc_data.container));
+       } else
+       if (strcmp(fmp->key, "GEOCACHE_TYPE") == 0) {
+            /* Geocache Type */
+            sprintf(buff, fmp->printfc, gs_get_cachetype(wpt->gc_data.type));
         } else {
            /* this should probably never happen */
         }
index 0646688e5c21ff2816584ad6ffb8e8544909f38a..5348dcdb423dd872604c10798af58eee357578ec 100644 (file)
@@ -468,7 +468,6 @@ gs_container_mapping{
        { gc_virtual, "Virtual" }
 };
 
-static
 geocache_type
 gs_mktype(char *t)
 {
@@ -483,7 +482,20 @@ gs_mktype(char *t)
        return gt_unknown;
 }
 
-static
+const char *
+gs_get_cachetype(geocache_type t)
+{
+       int i;
+       int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]);
+
+       for (i = 0; i < sz; i++) {
+               if (t == gs_type_map[i].type) {
+                       return gs_type_map[i].name;
+               }
+       }
+       return "Unknown";
+}
+
 geocache_container
 gs_mkcont(char *t)
 {
@@ -498,6 +510,20 @@ gs_mkcont(char *t)
        return gc_unknown;
 }
 
+const char *
+gs_get_container(geocache_container t)
+{
+       int i;
+       int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]);
+
+       for (i = 0; i < sz; i++) {
+               if (t == gs_container_map[i].type) {
+                       return gs_type_map[i].name;
+               }
+       }
+       return "Unknown";
+}
+
 static
 time_t 
 xml_parse_time( char *cdatastr ) 
index 5f0152818bbb5b8c45d94d2c52eb043731bac3de..5deb5799c0e2eb26e77877c632f1462233b510ae 100644 (file)
@@ -301,6 +301,34 @@ The fields used by the XCSV parser are as follows:
    
    example: IFIELD TIMET_TIME,"","%ld"
 
+ o GEOCACHE_DIFF
+   GEOCACHE_DIFF is valid only for geocaches and represents a DOUBLE 
+   PRECISION FLOAT.  A "three and a half star" cache would therefore be "3.5"
+
+   example: IFIELD GEOCACHE_DIFF,"","%3.1f"
+
+ o GEOCACHE_TERR
+   GEOCACHE_TERR is valid only for geocaches and represents a DOUBLE 
+   PRECISION FLOAT.  A "three and a half star" cache would therefore be "3.5"
+
+   example: IFIELD GEOCACHE_TERR,"","%3.1f"
+
+ o GEOCACHE_CONTAINER
+   GEOCACHE_CONTAINER is valid only for geocaches and is heavily influenced
+   by the Groundspeak container types.   Examples would include "Micro" 
+   and "Virtual".
+
+   example: GEOCACHE_CONTAINER,"","%s"
+
+ o GEOCACHE_TYPE
+   GEOCACHE_TYPE is valid only for geocaches and is heavily influenced
+   by the Groundspeak cache types.   Examples would include "Event cache" 
+   and "Multi-Cache".
+
+   example: GEOCACHE_TYPE,"","%s"
+
+
+
 
 EXAMPLES:
 --------